package com.zlq.cn.controller.api;


import com.zlq.cn.annotations.ApiParamBean;
import com.zlq.cn.annotations.UnLogin;
import com.zlq.cn.api.ApiParam;
import com.zlq.cn.entity.HotelbookLog;
import com.zlq.cn.service.un.HotelbookLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zhoucl
 * @since 2020-07-13
 */
@RestController
@RequestMapping("/api/hotelbookLog")
public class HotelbookLogController {
    @Autowired
    private HotelbookLogService hotelbookLogService;

    @RequestMapping("/addLog")
    @UnLogin
    public Object addLog(@RequestBody ApiParam apiParam, @ApiParamBean HotelbookLog hotelbookLog) {
        hotelbookLog.setCreateTime(LocalDateTime.now());
        hotelbookLog.setUpdateTime(LocalDateTime.now());
        hotelbookLogService.save(hotelbookLog);
        return "上传成功";
    }

    @RequestMapping("/loglist")
    @UnLogin
    public Object loglist(@RequestBody ApiParam apiParam, String time, String bundleId) {
        return hotelbookLogService.loglist(time, bundleId);
    }
}

